<head>
  <script src="jquery/jquery.min.js"></script>
  <script src="jsmol/JSmol.min.js"></script>
  <script type="text/javascript">
    var myJmol = 'myJmol';    var myJmol2 = 'myJmol2';

    var JmolInfo = {
      width: '100%',
      height: '100%',
      color: '#E2F4F5',
      j2sPath: 'jsmol/j2s',
      serverURL: '../jmol/php/jsmol.php',
      use: 'html5'
    }
    var jmolInfo = {
      height: 400,
      width: 400,
      use: "HTML5",
      j2sPath: './public/jsmol/j2s',
      serverURL: "php/jsmol.php"
    };
    $(document).ready(function () {
      $('#JmolDiv').html(Jmol.getAppletHtml(myJmol, JmolInfo));
      $('#JmolDiv2').html(Jmol.getAppletHtml(myJmol2, JmolInfo));

      Jmol.script(myJmol, 'load "78_Ni27Al5Ti16.cif"');
      Jmol.script(myJmol2, 'load "78_Ni27Al5Ti162.cif"');
    });
    async function loadMolecule(moleculeName) {
      console.log('0');
      Jmol.script(myJmol, 'load "gold.cif"');
      Jmol.script(myJmol2, 'load "nacl.cif"');
    }

     async function loadMolecule2(moleculeName) {
      console.log('ddd1');
      Jmol.script(myJmol, 'load "icsd_200866.cif"');
      Jmol.script(myJmol2, 'load "icsd_250072.cif"');
    }
	
	async function loadMolecule3(moleculeName) {
      console.log('ddd2');
	  var data = "5 4 C 5.88 -4.59 C 7.09 -3.89 C 8.30 -4.59 C 4.73 -3.79 Cl 7.09 -2.49 1 2 1 2 3 1 1 4 1 2 5 -2";
	  var cmd1 = 'load inline "' + data + '";spacefill 80%;';
	  var cmd = 'load inline "5 4 C 5.88 -4.59 C 7.09 -3.89 C 8.30 -4.59 C 4.73 -3.79 Cl 7.09 -2.49 1 2 1 2 3 1 1 4 1 2 5 -2";spacefill 40%;';
      console.log(cmd1);console.log(cmd);
	  Jmol.script(myJmol, 'load inline "5 4 C 5.88 -4.59 C 7.09 -3.89 C 8.30 -4.59 C 4.73 -3.79 Cl 7.09 -2.49 1 2 1 2 3 1 1 4 1 2 5 -2";spacefill 40%;');
      Jmol.script(myJmol2, cmd1);
    }
	
	
	async function loadMolecule4(data) {
      console.log('ddd2');
	  var cmd1 = 'load inline "' + data + '";spacefill 80%;';
	  var cmd = 'load inline "5 4 C 5.88 -4.59 C 7.09 -3.89 C 8.30 -4.59 C 4.73 -3.79 Cl 7.09 -2.49 1 2 1 2 3 1 1 4 1 2 5 -2";spacefill 40%;';
      console.log(cmd1);console.log(cmd);
	  Jmol.script(myJmol, 'load inline "5 4 C 5.88 -4.59 C 7.09 -3.89 C 8.30 -4.59 C 4.73 -3.79 Cl 7.09 -2.49 1 2 1 2 3 1 1 4 1 2 5 -2";spacefill 40%;');
      Jmol.script(myJmol2, cmd1);
    }
  </script>
</head>

<body>
  <div id="JmolDiv" style="width:30vmin; height:30vmin;"></div>
  <div id="JmolDiv2" style="width:30vmin; height:30vmin;"></div>
  <button onclick="loadMolecule('78_Ni27Al5Ti162.cif')">Load Caffeine</button>
  <button onclick="loadMolecule2('78_Ni27Al5Ti16.cif')">Load Aspirin</button>
  <button onclick="loadMolecule('water')">Load Water</button>
  <button onclick="loadMolecule3('water')">Load Water</button>

</body>